<?php

/**
*	删除(物理删除),恢复用户信息
*
*/

//包含公共文件
include '../../common/common.php';

//获取get传值
// var_dump($_POST);
$userBtn2 = $_POST['userBtn2'];
$arrUser2 = $_POST['arrUser2'];
$strUser2 = join(',' , $arrUser2);

// var_dump($userBtn2);
// var_dump($arrUser2);
// var_dump($strUser2);

//判断选项是否为空
if (!$arrUser2) {

	exit('选项不得为空<br /> <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
}

//删除用户
if ($userBtn2 == '删 除') {

	//删除数据
	$delUser = myDelete($link , DB_TABLE_USER ,  "uid in ($strUser2)");
	$delUserPost = myDelete($link , DB_TABLE_DETAIL , "authorid in ($strUser2)");
	// var_dump($delUser);
	// var_dump($delUserPost);

	if  (!$delUser) {
		exit('删除失败<br /> <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
	}

	//跳转页面
	echo '删除成功';
	header('refresh:1;url=' . $_SERVER['HTTP_REFERER']);
}

//修改数据,恢复用户显示
if ($userBtn2 == '恢 复') {

	//修改数据
	$updateUser = myUpdate($link , DB_TABLE_USER , ['uisdel' => 0] , "uid in ($strUser2)");
	$userPost = myUpdate($link , DB_TABLE_DETAIL , ['isdel' => 0 , 'userdel' => 0],  "authorid in ($strUser2)");
	// var_dump($updateUser);

	if  (!$updateUser) {
		exit('恢复失败<br /> <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
	}

	//跳转页面
	echo '恢复成功';
	header('refresh:1;url=' . $_SERVER['HTTP_REFERER']);
}


